<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Mobile Webkit position:fixed Demo</title>
  <style type="text/css">
 body {
   font-family: "Helvetica Neue", Helvetica, sans-serif;
   line-height: 1.4;
 }
 .container {
   margin: 40px auto;
   width: 300px;
 }
 h2 {
   text-align: center;
 }
.mainnav {
   left: 50%;
   top: 100px;
   position: fixed;
   margin-left: -400px;
   width: 140px;
 }
 .hack-list {
  list-style-type: lower-alpha;
 }
  </style>

</head>
<body>
  <div id="top" class="container">

    <ul class="mainnav">
      <li><a href="#p1">p1</a></li>
      <li><a href="#p2">p2</a></li>
      <li><a href="#p3">p3</a></li>
      <li><a href="#p4">p4</a></li>
      <li><a href="#p5">p5</a></li>
      <li><a href="#top">back to top</a></li>
    </ul>

    <h3>In Mobile Safari (iPad/iPhone):</h3>
    <ol>
      <li>Click one of the navigation links to the left. *Works*</li>
      <li>Click another. *Does NOT Work*</li>
      <li>Scroll the page a little manually by touching and dragging.</li>
      <li>Click one of the navigation links to the left. *Works*</li>
      <li>Click another. *Does NOT Work*</li>
    </ol>


    <h3>Stupid Hack Demo:</h3>
    <ol class="hack-list">
      <li><button type="button">Load stupid hack</button></li>
      <li>Repeat steps 1 and 2. They should both work.</li>
      <li>Groan when you see the hack.</li>
    </ol>

    <pre>
$(document).ready(function() {
  $('button').one('click', function() {

    <strong>// Start stupid hack</strong>
    var $stupid = $('&lt;div&gt;&lt;/div&gt;')
      .height(1)
      .hide()
      .appendTo('body');

    $('ul.mainnav').on('click', 'a', function() {
      $stupid.show();
      setTimeout(function() {
        $stupid.hide();
      }, 10);
    });
    <strong>// end stupid hack</strong>

  });
});

    </pre>

    <hr>

    <p id="p1">p1 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p id="p2">p2 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p id="p3">p3 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p id="p4">p4 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p id="p5">p5 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p id="p6">p6 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p class="subnav"><a href="#p1">p1</a> <a href="#p2">p2</a> <a href="#p3">p3</a> <a href="#p4">p4</a></p>

  </div>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
  <script>!window.jQuery && document.write(unescape('%3Cscript src="../lib/jquery/jquery.js"%3E%3C/script%3E'));</script>

  <script src="../src/jquery.smooth-scroll.js"></script>
  <script>
    $(document).ready(function() {
      $('button').one('click', function() {

        // Start stupid hack
        var $stupid = $('<div></div>')
          .height(1)
          .hide()
          .appendTo('body');

        $('ul.mainnav').on('click', 'a', function() {
          $stupid.show();
          setTimeout(function() {
            $stupid.hide();
          }, 10);
        });
        // end stupid hack

      });
    });

  </script>

</body>
</html>
